package org.example.strategy;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Map;

public class CloseFileStrategy implements EditorStrategy {
    private  Integer fileNumber;
    private ArrayList<String> loadedFileName;
    private ArrayList<String> loadedFilePath;
    private ArrayList<Boolean> isLoadedFileChanged ;
    private Map<String, LinkedList<String>> nameAndContent;
    public CloseFileStrategy(Integer fileNumber,ArrayList<String> loadedFileName,ArrayList<String> loadedFilePath,ArrayList<Boolean> isLoadedFileChanged,Map<String, LinkedList<String>> nameAndContent){
        this.fileNumber = fileNumber;
        this.loadedFileName = loadedFileName;
        this.isLoadedFileChanged = isLoadedFileChanged;
        this.loadedFilePath = loadedFilePath;
        this.nameAndContent = nameAndContent;
    }

    public Integer getFileNumber() {
        return fileNumber;
    }

    public ArrayList<String> getLoadedFileName() {
        return loadedFileName;
    }

    public ArrayList<String> getLoadedFilePath() {
        return loadedFilePath;
    }

    public ArrayList<Boolean> getIsLoadedFileChanged() {
        return isLoadedFileChanged;
    }

    public Map<String, LinkedList<String>> getNameAndContent() {
        return nameAndContent;
    }

    @Override
    public void performAction() {
        nameAndContent.remove(loadedFileName.get(fileNumber - 1));
        isLoadedFileChanged.remove(fileNumber - 1);
        loadedFilePath.remove(fileNumber - 1);
        loadedFileName.remove(fileNumber - 1);
    }
}
